using System.Windows.Forms;
using ViScript.Core;
using ViScript.Core.Argument;

namespace ViScript.Example
{
    public class NormalParsedSentenceVisualizer : ISentenceRuleVisitor, IArgumentVisitor
    {
        private readonly TreeNodeCollection nodes;

        public NormalParsedSentenceVisualizer(TreeNodeCollection nodes)
        {
            this.nodes = nodes;
        }

        public void VisitNativeSentenceRule(SentenceRule sentenceRule)
        {
            nodes.Add("Rule: " + sentenceRule);
        }

        public void VisitClauseArgument(ClauseArgument clauseArgument)
        {
            nodes.Add("Arg: [clause]");
        }

        public void VisitNormalArgument(NormalArgument normalArgument)
        {
            nodes.Add("Arg" + ": " + normalArgument.Value);
        }

        public void VisitUnrecognizedArgument(UnrecognizedArgument unrecognizedArgument)
        {
            nodes.Add("Arg: [unrecognized]");
        }
    }
}